import { ApiPropertyOptional } from '@nestjs/swagger';
import { 
  IsString, 
  IsUUID, 
  IsOptional, 
  IsEnum, 
  IsDateString 
} from 'class-validator';
import { Priority, TaskStatus } from '../../../types/enums';

export class UpdateTaskDto {
  @ApiPropertyOptional({
    description: '任务标题',
    example: '完成登录页面设计和开发',
  })
  @IsOptional()
  @IsString({ message: '任务标题必须是字符串' })
  title?: string;

  @ApiPropertyOptional({
    description: '任务描述',
    example: '根据UI设计稿完成登录页面的前端实现，包括表单验证和错误提示。',
  })
  @IsOptional()
  @IsString({ message: '任务描述必须是字符串' })
  description?: string;

  @ApiPropertyOptional({
    description: '指派给谁',
    example: '123e4567-e89b-12d3-a456-426614174000',
  })
  @IsOptional()
  @IsUUID('4', { message: '指派人ID必须是有效的UUID' })
  assigneeId?: string;

  @ApiPropertyOptional({
    description: '任务状态',
    enum: TaskStatus,
    example: TaskStatus.IN_PROGRESS,
  })
  @IsOptional()
  @IsEnum(TaskStatus, { message: '任务状态无效' })
  status?: TaskStatus;

  @ApiPropertyOptional({
    description: '优先级',
    enum: Priority,
    example: Priority.HIGH,
  })
  @IsOptional()
  @IsEnum(Priority, { message: '优先级无效' })
  priority?: Priority;

  @ApiPropertyOptional({
    description: '开始日期',
    example: '2023-01-01T00:00:00Z',
  })
  @IsOptional()
  @IsDateString({}, { message: '开始日期格式无效' })
  startDate?: string;

  @ApiPropertyOptional({
    description: '截止日期',
    example: '2023-01-15T00:00:00Z',
  })
  @IsOptional()
  @IsDateString({}, { message: '截止日期格式无效' })
  dueDate?: string;
} 